package changgou.itheima.service;

import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.util.Date;
import java.util.Map;
@Data
@Document(indexName = "skuinfo",type = "docs")
public class SkuInfo {
    //`id` varchar(20) NOT NULL COMMENT '商品id',
    @Id
    @Field(index = true,store = true,type = FieldType.Keyword)
    private Long id;
    //`name` varchar(200) NOT NULL COMMENT 'SKU名称',
    @Field(index = true,store = true,type = FieldType.Text,analyzer = "ik_smart")
    private String name;
    //`price` int(20) NOT NULL COMMENT '价格（分）',
    @Field(type = FieldType.Double,index = true)
    private Long price;
      //`num` int(10) NOT NULL COMMENT '库存数量',
    @Field(index = false,store = true,type = FieldType.Integer)
    private  Integer num;
   // `image` varchar(200) DEFAULT NULL COMMENT '商品图片',\
    @Field(index = false,store = true,type = FieldType.Text)
    private String image;
    //    `status` char(1) DEFAULT '1' COMMENT '商品状态 1-正常，2-下架，3-删除',
    @Field(index = true,store = true,type = FieldType.Keyword)
    private Integer status;
    //创建时间
    private Date createTime;
    //更新时间
    private Date updateTime;
    //是否默认
    @Field(index = true, store = true, type = FieldType.Keyword)
    private String isDefault;
    //spuid
    @Field(index = true, store = true, type = FieldType.Long)
    private Long spuId;
    //类目ID
    @Field(index = true, store = true, type = FieldType.Long)
    private Long categoryId;
    //类目名称
    @Field(index = true, store = true, type = FieldType.Keyword)
    private String categoryName;
    //品牌名称
    @Field(index = true, store = true, type = FieldType.Keyword)
    private String brandName;
    //规格
    private String spec;
    //规格参数
    private Map<String, Object> specMap;
}
